<template>
  <div id="app">
    <router-view />
  </div>
</template>

<script setup>
import { onMounted } from 'vue'
import { useUserStore } from '@/stores/user'
import { usePermissionStore } from '@/stores/permission'

const userStore = useUserStore()
const permissionStore = usePermissionStore()

onMounted(() => {
  // 检查是否有保存的token
  const token = localStorage.getItem('token')
  if (token) {
    userStore.setToken(token)
    userStore.getUserInfo()
    permissionStore.getUserMenus()
  }
})
</script>

<style>
#app {
  height: 100vh;
}
</style> 